using System;
using System.Diagnostics;
using System.IO;

namespace IncrementalSave
{
    [DebuggerDisplay("HistoryItem: {DocumentName}, {SaveTime}")]
    public class HistoryItem
    {
        private string _documentName;
        public uint DocCookie { get; internal set; }
        public DateTime SaveTime { get; internal set; }
        public string SaveTimeText
        {
            get
            {
                string saveTimeText;
                if (SaveTime.Date == DateTime.Now.Date)
                    saveTimeText = SaveTime.ToShortTimeString();
                else if (SaveTime.Date == DateTime.Now.AddDays(-1))
                    saveTimeText = "Yesterday";
                else
                    saveTimeText = SaveTime.ToShortDateString();
                return saveTimeText;
            }
        }
        public string FileText { get; set; }
        public string DocumentFilePath { get; internal set; }
        public string DocumentName {
            get
            {
                if (_documentName == null)
                    _documentName = Path.GetFileName(DocumentFilePath);
                return _documentName;
            } 
        }

        public string IncrementalFilePath { get; internal set; }
    }
}